home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10567 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1000 b 

  1. Path: news.umbc.edu!not-for-mail
  2. From: schlein@umbc.edu (Jonas J. Schlein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: A question on for loop
  5. Date: 18 Mar 1996 14:19:54 -0500
  6. Organization: University of Maryland Baltimore County
  7. Message-ID: <4ikd0q$3c0@umbc9.umbc.edu>
  8. References: <31471574.79D9@hdc-usa.com> <4i77ca$161@ccshst05.cs.uoguelph.ca>
  9. NNTP-Posting-Host: umbc9.umbc.edu
  10. NNTP-Posting-User: schlein
  11.  
  12. |> My novice's answer is yes, i starts off at 0 because the for statement 
  13. |> (i=0;i<20;i++) has i++ meaning that i is incremented after the 
  14. |> operation.  If it were (i=0;i<20;++i) then i would start at 1 and run up 
  15. |> to 20.  Is this correct?
  16. |> Toby Hay   thay@uoguelph.ca
  17.  
  18. No you are 100% wrong...Both of the for() loops you have there are identical
  19. except for the fact one had i++ and the other ++i. If you wanted it to
  20. start at 1 and run to 20 then write it as (i = 1; i < 20; i++).
  21. -- 
  22. "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
  23.  
  24. Jonas J. Schlein  (schlein@gl.umbc.edu)
  25.